package com.scau.os.deviceManagement;



import com.scau.os.course_manager.bean.DeviceAllocationTable;
import com.scau.os.extension.EventSystem;
import com.scau.os.extension.MyDelegate;

public class DeviceExecute {

    public static void executePeripheral() {
        for (String peripheral_name : DeviceUse.peripherals.keySet()) {
            Peripheral peripheral = DeviceUse.peripherals.get(peripheral_name);
            if (peripheral.getStatus() == 127) {
                EventSystem.instance.SendEvent("RefreshPeripheral", peripheral_name);
                peripheral.refresh(1);
                if(peripheral.getStatus() ==0){
                    EventSystem.instance.SendEvent("awakeProcess", new DeviceAllocationTable(peripheral_name
                    ,0,DeviceUse.Process.get(peripheral_name)) );
                    EventSystem.instance.SendEvent("RefreshPeripheral", peripheral_name);
                    //DeviceUse.Process.remove(peripheral_name);
                }

            }
        }
    }

}
